package com.nts.visionworks.business.application.domain;

// Generated 2013. 6. 23 ���� 6:33:40 by Hibernate Tools 4.0.0

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.nts.visionworks.core.validation.EntityIdNotNull;

/**
 * ApplicationRelease generated by hbm2java
 */
@Entity
@Table(name = "application_release", catalog = "visionworks")
public class ApplicationRelease implements java.io.Serializable
{

	private Long releaseId;
	private String version;
	private ServiceApplication serviceApplication;
	private String description;
	private Date releasedDateTime;
	private long releasedId;
	private Set<ApplicationUpdated> applicationUpdateds = new HashSet<ApplicationUpdated>(
			0);

	public ApplicationRelease()
	{
	}

	public ApplicationRelease(ServiceApplication serviceApplication,
			Date releasedDateTime, long releasedId)
	{
		this.serviceApplication = serviceApplication;
		this.releasedDateTime = releasedDateTime;
		this.releasedId = releasedId;
	}

	public ApplicationRelease(ServiceApplication serviceApplication,
			String description, Date releasedDateTime, long releasedId,
			Set<ApplicationUpdated> applicationUpdateds)
	{
		this.serviceApplication = serviceApplication;
		this.description = description;
		this.releasedDateTime = releasedDateTime;
		this.releasedId = releasedId;
		this.applicationUpdateds = applicationUpdateds;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ReleaseId", unique = true, nullable = false)
	public Long getReleaseId()
	{
		return this.releaseId;
	}

	public void setReleaseId(Long releaseId)
	{
		this.releaseId = releaseId;
	}

	@NotNull(message = "validation.applicationRelease.version.notNull")
	@Size(message = "validation.applicationRelease.version.length", max = 50, min = 1)
	@Column(name = "Version", nullable = false, length = 50)
	public String getVersion()
	{
		return this.version;
	}

	public void setVersion(String version)
	{
		this.version = version;
	}

	@EntityIdNotNull(message = "validation.applicationRelease.serviceApplication.notNull")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ApplicationId", nullable = false)
	public ServiceApplication getServiceApplication()
	{
		return this.serviceApplication;
	}

	public void setServiceApplication(ServiceApplication serviceApplication)
	{
		this.serviceApplication = serviceApplication;
	}

	@Max(message = "validation.applicationRelease.description.max", value = 1000)
	@Column(name = "Description", length = 1000)
	public String getDescription()
	{
		return this.description;
	}

	public void setDescription(String description)
	{
		this.description = description;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "ReleasedDateTime", nullable = false, length = 19)
	public Date getReleasedDateTime()
	{
		return this.releasedDateTime;
	}

	public void setReleasedDateTime(Date releasedDateTime)
	{
		this.releasedDateTime = releasedDateTime;
	}

	@Column(name = "ReleasedId", nullable = false)
	public long getReleasedId()
	{
		return this.releasedId;
	}

	public void setReleasedId(long releasedId)
	{
		this.releasedId = releasedId;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "applicationRelease")
	public Set<ApplicationUpdated> getApplicationUpdateds()
	{
		return this.applicationUpdateds;
	}

	public void setApplicationUpdateds(
			Set<ApplicationUpdated> applicationUpdateds)
	{
		this.applicationUpdateds = applicationUpdateds;
	}

}
